<html>
<head><meta charset="utf-8"><title>DefPath-relative expansions · t-compiler/wg-incr-comp · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/index.html">t-compiler/wg-incr-comp</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html">DefPath-relative expansions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="233078756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233078756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233078756">(Apr 04 2021 at 12:39)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span>, I stumbled upon <a href="https://github.com/rust-lang/rust/issues/49300#issuecomment-525531109">https://github.com/rust-lang/rust/issues/49300#issuecomment-525531109</a> recently.<br>
Has this proposal ever been implemented? Do you still think it worth pursuing?</p>



<a name="233080749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233080749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233080749">(Apr 04 2021 at 13:17)</a>:</h4>
<p>IIRC, <span class="user-mention" data-user-id="125294">@Aaron Hill</span> tried it when implementing <a href="https://github.com/rust-lang/rust/pull/72121">https://github.com/rust-lang/rust/pull/72121</a> and it was found too expensive to construct a <code>DefPath</code> and <code>DefId</code> for every expansion.</p>



<a name="233080916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233080916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233080916">(Apr 04 2021 at 13:20)</a>:</h4>
<p>That's correct</p>



<a name="233080952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233080952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233080952">(Apr 04 2021 at 13:21)</a>:</h4>
<p>So <code>ExpnId</code>s don't currently have a stable representation, but are instead serialized as is (as crate-local IDs) and then somehow remapped into fresh crate-local <code>ExpnId</code>s during deserialization, I don't remember the details.</p>



<a name="233081165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233081165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233081165">(Apr 04 2021 at 13:25)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/f98135b7a24a54964f83ca1dc2dfb6bd1d35b1bd/compiler/rustc_span/src/hygiene.rs#L1081">https://github.com/rust-lang/rust/blob/f98135b7a24a54964f83ca1dc2dfb6bd1d35b1bd/compiler/rustc_span/src/hygiene.rs#L1081</a></p>



<a name="233083083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233083083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233083083">(Apr 04 2021 at 14:02)</a>:</h4>
<p>Ok, I did not realize that creating a DefPath was that costly. Did you try having ExpnId relative to DefPath, without actually creating a DefPath?</p>



<a name="233093421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233093421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233093421">(Apr 04 2021 at 15:50)</a>:</h4>
<p>Here's the perf run from when I tried it: <a href="https://github.com/rust-lang/rust/pull/72121#issuecomment-627093462">https://github.com/rust-lang/rust/pull/72121#issuecomment-627093462</a></p>



<a name="233093562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233093562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233093562">(Apr 04 2021 at 15:51)</a>:</h4>
<p>there was some other hygiene stuff mixed in with that commit, so that perf run might be an overestimate</p>



<a name="233093633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233093633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233093633">(Apr 04 2021 at 15:52)</a>:</h4>
<p>The diff between the first and the last perf run allows to remove this overestimate.</p>



<a name="233093817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233093817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233093817">(Apr 04 2021 at 15:54)</a>:</h4>
<p>I don't <em>think</em> any of the (non-incremental) def path table stuff has changed since I did that perf run</p>



<a name="233093825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233093825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233093825">(Apr 04 2021 at 15:54)</a>:</h4>
<p>but take that perf run with a grain of salt</p>



<a name="233109906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative%20expansions/near/233109906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/DefPath-relative.20expansions.html#233109906">(Apr 04 2021 at 20:45)</a>:</h4>
<p>I'll ask some silly questions:</p>
<ul>
<li>Why do we need a stable representation for <code>ExpnId</code>s? (In single-crate incremental case, in cross-crate cases)</li>
<li>What other choices for a stable representation for <code>ExpnId</code>s do we have actually, besides def-paths + def-path-local indices/offsets?</li>
</ul>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>